
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BusinessObject;
using DataAccessLayer;

namespace BusinessLogic
{
    /// <summary>
    /// Define LanguageUtil class. This class user for BussinessLayer.

    /// </summary>
    public class LanguageUtil
    {
        /// <summary>
        /// Define function Insert for Language Object.
        /// </summary>
        /// <param name="t">object data need Insert.</param>
        /// <returns>
        ///    True: if insert successfull.
        ///    False: if insert error.
        ///</returns>
        public static bool Insert(Language t)
        {
            BizObject.PurgeCacheItems("Language");

            return LanguageDao.Insert(t);
        }
        /// <summary>
        /// Define function Update for Language Object.
        /// </summary>
        /// <param name="t">project data need updated.</param>
        /// <returns>
        ///    True: if update successful.
        ///    False: if update Error.
        ///</returns>
        public static bool Update(Language t)
        {
            BizObject.PurgeCacheItems("Language");

            return LanguageDao.Update(t);
        }
        /// <summary>
        /// Get All Language object from table Language.
        /// </summary>
        /// <returns>List Language object.</returns>
        public static List<Language> GetAll()
        {
            List<Language> obj = null;
            string key = "Language_GetAll";
            if (BizObject.Cache[key] != null)
            {
                obj = (List<Language>)BizObject.Cache[key];
            }
            else
            {
                obj = LanguageDao.GetAll();
                BizObject.CacheData(key, obj);
            }
            return obj;
        }
        /// <summary>
        /// Search Language object in table Language.
        /// </summary>
        /// <param name="t">Condition for Search.</param>

        /// <returns>List Language objects.</returns>

        public static List<Language> SearchLanguage(Language t)
        {
            return LanguageDao.SearchLanguage(t);
        }
        /// <summary>
        /// Get a Language data object by primary key. 
        /// </summary>
        /// <param name="languageId" >This is primary key.</param>
        /// <returns>A Language object.</returns>

        public static Language Get(string languageId)
        {
            Language obj = null;
            string key = "Language_Get_" + string.Format("{0}", languageId);
            if (BizObject.Cache[key] != null)
            {
                obj = (Language)BizObject.Cache[key];
            }
            else
            {
                obj = LanguageDao.Get(languageId);
                BizObject.CacheData(key, obj);
            }
            return obj;
        }

        /// <summary>
        /// This function to Delete Language object by primary key.
        /// </summary>
        /// <param name="languageId" >This is primary key.</param>
        /// <returns>If succesful return True else  return False.</returns>

        public static bool Delete(string languageId)
        {
            BizObject.PurgeCacheItems("Language");

            return LanguageDao.Delete(languageId);
        }
        public static bool Publish(string languageID)
        {
            BizObject.PurgeCacheItems("Language");
            return LanguageDao.Publish(languageID);
        }
        public static bool Order(string languageId, int type)
        {
            BizObject.PurgeCacheItems("Language");
            return LanguageDao.Order(languageId,type);
        }
    }
}